import request from "@/utils/request";
import { downLoadAll } from "@/utils/zipdownload";

// 获取详细信息
export function authList(data) {
  return request({
    url: "/order/info/authList",
    method: "get",
    params: data
  });
}

// 订单明细 - 获取订单明细信息
export function authDetailList(data) {
  return request({
    url: "/order/detail/authList",
    method: "get",
    params: data
  });
}

// 历史操作列表
export function getHistoryList(data) {
  return request({
    url: "/record/form/list",
    method: "get",
    params: data
  });
}

// 下载链接
export function downloadAuthFile(id) {
  var url = "/record/execute/downloadLicence/" + id;
  return downLoadAll(url);
}

// 授权导入-获取模块控制列表
export function getModuleLicenceData(data) {
  return request({
    url: "/record/execute/getModuleLicenceData",
    method: "get",
    params: data
  });
}

// 授权导入-提交授权信息
export function submitValid(data) {
  return request({
    url: "/record/execute/valid",
    method: "post",
    data: data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
}

// export function submitValid(data) {
//   axios({
//     method: "post",
//     url: "/record/execute/valid",
//     data: data,
//     responseType: "blob",
//     headers: {
//       Authorization: "Bearer " + getToken(),
//       "content-Type": "multipart/form-data"
//     }
//   }).then(res => {});
// }

// 部门授权数据回显
export function getDeptLicenceData(data) {
  return request({
    url: "/record/execute/getDeptLicenceData",
    method: "get",
    params: data
  });
}

// 授权校验接口
export function validPoints(data) {
  return request({
    url: "/record/execute/validPoints",
    method: "post",
    data: data
  });
}
